import React, { Component } from "react"
import companyAccountSettingService from "../company-account-setting.service";

class Ali extends Component {

  state = {
    tokenVisible: null
  };

  componentDidMount() {
    const { alipayAccountId, accountNumber } = this.props.location.state.params;
    companyAccountSettingService.saveAuthToken({
      isvBizId: accountNumber,
      isvReturnUrl: `${location.origin}/main/pay-setting/company-account-setting/ali-bank-account-detail/${alipayAccountId}`
    }).then(res => {
      this.setState({ tokenVisible: res.data })
    })
  }

  render() {
    const { tokenVisible } = this.state;
    return (
      <div>
        <iframe srcDoc={tokenVisible} style={{width: '100%', height: 'calc(100vh - 80px)'}}/>
      </div>
    )
  }

}

export default Ali
